package com.yuhan.business.controller;

import com.yuhan.business.entity.User;
import com.yuhan.business.service.UserService;
import com.yuhan.common.base.BaseController;
import com.yuhan.common.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(description = "系统用户")
@RestController
@RequestMapping("/v1/user/")
public class UserController extends BaseController<UserService, User> {
    @Autowired
    UserService userService;

    @ApiOperation("根据条件分页查询")
    @GetMapping("/list")
    public R getList(User user, @ApiParam(name = "pageNumber", value = "当前第几页", required = true) @RequestParam(defaultValue = "1") Integer pageNumber,
                     @ApiParam(name = "pageSize", value = "每页几条", required = true) @RequestParam(defaultValue = "15") Integer pageSize) {
        return R.ok(userService.findPage(pageNumber, pageSize, user));
    }
}
